package iplocation

import (
	"encoding/json"
	"fmt"
	"github.com/gin-gonic/gin"
	"img/common/myhttp"
	"img/common/response"
)

func Get(c *gin.Context) {
	ip := c.Query("ip")
	rs, _ := myhttp.Get(fmt.Sprintf("https://api.iplocation.net/?ip=%s", ip))
	fmt.Println(string(rs))
	result := make(map[string]interface{})
	json.Unmarshal(rs, &result)
	response.OkWithData(result, c)
}
